/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */

#include "CameraObject.h"
#include "SceneObject.h"

namespace PQEngine
{
	CameraObject::CameraObject(SceneObject* scene)
		: GameObject(scene,GAME_OBJECT_CAMERA),_camera(0)
	{
		this->setName("Camera Object");
		
		_camera=scene->getSceneManager()->createCamera("Camera"+Ogre::StringConverter::toString(getId()));
		
		_sceneNode->attachObject(_camera);
		

		Ogre::RenderWindow* window=scene->getRenderWindow();

		_viewport= window->addViewport(_camera);
		_viewport->setBackgroundColour(scene->getRenderProperty().getBackground());
        _camera->setAspectRatio(Ogre::Real(_viewport->getActualWidth())/Ogre::Real(_viewport->getActualHeight()));

	}
	
}
